public class Test3 {
    public static void main(String[] args) {
        int[] arr = new int[]{1, 2, 3, 4, 5};

        for (int i = 0; i < 10; i++) {
            if (i == arr.length) {
//                throw new ArrayIndexOutOfBoundsException("数组下标越界");

                ArrayIndexOutOfBoundsException e = new ArrayIndexOutOfBoundsException("数组下标越界");

                throw e;
            }
            System.out.println(arr[i]);
        }
    }
}
